/**
 * Created by xxx on 2018年1月4日.
 */
var myChart = "",option = "",myChartTwo = "",optionTwo = "",myChartThree = "",optionThree = "";
//父组件
var Main = React.createClass({
    //组件初始状态
    getInitialState: function () {
        return {
            selectData: {},
            tableHeaderDate: [],//表单头部数据
            tableBodyDate: [],//表单内容数据
            addressData: [],//左侧地址数据
            listBasicData: [],//业务列表数据
            listResultData: [],//
            childChaer: {},//
            navigation: '',//统计导航
            addressUuid:'',
            menuType: '1',//1 列表 2柱状图
            droupName: '所有',
            listBasic: '',
            chartLoad: false,
            addressChildStatistic:{
                isShowBtn:false,
                isShowSta:false
            },//地址自己统计（地区为柱状时）
            orgInfo: {
                id: '',
                type: '',
                orgName: '',
                index: []
            }
        }
    },
    componentDidMount: function () {
        this.listBasic();
        this.getAddressListTwo(1,'china');//获取所有地址
        $('#beginTime').datetimepicker({
            format: "Y-m-d", //格式化日期
            timepicker: false, //显示时间选项
            todayButton: false, //关闭选择今天按钮
            step:1,//时间间隔
            // minDate: suixun.getNowFormatDate('yyyy-MM-dd', '1990-01-01')
        });
        $('#endTime').datetimepicker({
            format: "Y-m-d", //格式化日期
            timepicker: false, //显示时间选项
            todayButton: false, //关闭选择今天按钮
            step:1,//时间间隔
            minDate: suixun.getNowFormatDate('yyyy-MM-dd', '1990-01-01')
        });

    },
    /**
     * 获取业务列表
     */
    listBasic: function(){
        suixun.showLoding();//显示加载中
        suixun.ajax( serverUrl+'/count/listBasic.json','',"get",function(data){
            suixun.hideLoding();
            if(data.code == 200){
                this.setState({listBasicData:data.info==null?[]:data.info,listBasic:data.info==null?'':data.info[0].name});
                this.listResult('','',data.info==null?'':data.info[0].name);//获取所有地址
            }else{
                suixun.alert(data.msg);
            }
        }.bind(this));
    },
    /**
     * 获取统计数据
     * @param orgType 区域类型
     * @param orgId 区域id
     * @param listBasic 统计名称
     */
    listResult: function(orgType, orgId, listBasic){
        var droupName = this.state.droupName;
        var beginTime = $("#beginTime").val();
        var endTime = $("#endTime").val();
        if(listBasic==''){
            suixun.alert('请选择统计名称！');
            return;
        }
        if(droupName=='所有'){
            droupName = 0;
        }else if(droupName=='家长端'){
            droupName = 1;
        }else if(droupName=='教师端'){
            droupName = 2;
        }
        if(beginTime != '' && endTime != '' && new Date(beginTime) > new Date(endTime)){
            suixun.alert('开始时间不能大于结束时间！');
            return;
        }
        var prarm = 'name='+listBasic+'&appFrom='+droupName;
        if(orgType!=''){
            prarm += '&orgType='+orgType+'&orgId='+orgId
        }
        if(beginTime!=''){
            prarm += '&beginTime='+beginTime+' 00:00:00'
        }
        if(endTime!=''){
            prarm += '&endTime='+endTime+' 23:59:59'
        }
        if(this.state.menuType==1){
            suixun.showLoding();//显示加载中
        }
        suixun.ajax( serverUrl+'/count/listResult.json?'+prarm,'',"get",function(data){
            if(this.state.menuType==1){
                suixun.hideLoding();
            }
            if(data.code == 200){
                if(data.info==null || data.info.length==0){
                    // suixun.alert('没有查询到统计数据！');
                    this.setState({tableHeaderDate: [],tableBodyDate: []});
                    if(this.state.menuType==2){
                        this.initChartData([],[], this.state.menuType);
                    }
                }else{
                    var listResultData = data.info,tableHeaderDate = [],tableBodyDate = [],isLength = false;
                    this.setState({listResultData:data.info==null?[]:data.info});
                    for(var j = 0;j<listResultData.length;j++){
                        var head = [],
                            body = [];
                        for(var key in listResultData[j]){
                            if(j == 0){
                                head.push(key);
                            }
                            if(listResultData[j][key] == null){
                                isLength = true;
                                break;
                            }
                            body.push(listResultData[j][key]);
                        }
                        if(j == 0){
                            tableHeaderDate.push(head);
                        }
                        tableBodyDate.push(body);
                    }
                    if(isLength){
                        tableHeaderDate = [];
                        tableBodyDate = []
                    }
                    this.setState({tableHeaderDate: tableHeaderDate,tableBodyDate: tableBodyDate});
                    if(this.state.menuType==2){
                        this.initChartData(tableHeaderDate,tableBodyDate, this.state.menuType);
                    }
                }
            }else{
                suixun.alert(data.msg);
                this.setState({tableHeaderDate: [],tableBodyDate: []});
                if(this.state.menuType==2){
                    this.initChartData([],[], this.state.menuType);
                }
            }
        }.bind(this));
    },
    /**
     * 获取所有地址--商户地区地址
     * @param num 查询的是1：省 2：市 3：区 4：学校 5：年级 6：班级
     * @param uuid 要查询的其子机构的当前机构id,不传会返回国家，传”china”会返回所有省
     */
    getAddressListTwo: function (num,uuid,index=[0,0,0],select = false) {
        if(this.state.menuType==1){
            suixun.showLoding();//显示加载中
        }
        suixun.ajax(serverUrl+'/region/getRegions.json?uuid='+uuid,'',"get",function(data){
            if(this.state.menuType==1){
                suixun.hideLoding();//显示加载中
            }
            if(data.code == 200){
                var addressData = this.state.addressData;
                if(num == "1"){//省
                    addressData = [];
                    for(let i = 0 ;i < data.info.length;i++ ){
                        addressData[i] = {uuid:data.info[i].uuid,value:data.info[i].orgName,select:select,children:[],showChild:false,halfSelected:false};
                    }
                    this.setState({addressData: addressData});
                }else if(num == "2"){//市
                    let cityData = [];
                    let city = addressData[index[0]];
                    for(let i = 0 ;i < data.info.length;i++ ){
                        cityData[i] = {uuid:data.info[i].uuid,value:data.info[i].orgName,select:select,children:[],showChild:false,halfSelected:false};
                    }
                    city.children = cityData;
                    this.setState({addressData: addressData});
                }else if(num == "3"){//区
                    let townData = [];
                    let town = addressData[index[0]]['children'][index[1]];
                    for(let i = 0 ;i < data.info.length;i++ ){
                        townData[i] = {uuid:data.info[i].uuid,value:data.info[i].orgName,select:select,children:[],showChild:false,halfSelected:false};
                    }
                    town.children = townData;
                    this.setState({addressData:addressData});
                    this.setState({addressData: addressData});
                }else if(num == "4"){//学校
                    let schoolData = [];
                    let school =  addressData[index[0]]['children'][index[1]]['children'][index[2]];
                    if(data.info.length==0){
                        schoolData = new Array(10000);
                    }else{
                        for(let i = 0 ;i < data.info.length;i++ ){
                            schoolData[i] = {uuid:data.info[i].uuid,value:data.info[i].orgName,select:select,children:[],showChild:false,halfSelected:false};
                        }
                    }
                    school.children = schoolData;
                    this.setState({addressData: addressData});
                }else if(num == "5"){//年级
                    let gradeData = [];
                    let grade = addressData[index[0]]['children'][index[1]]['children'][index[2]]['children'][index[3]];
                    if(data.info.length==0){
                        gradeData = new Array(10000);
                    }else{
                        for(let i = 0 ;i < data.info.length;i++ ){
                            gradeData[i] = {uuid:data.info[i].uuid,value:data.info[i].orgName,select:select,children:[],showChild:false,halfSelected:false};
                        }
                    }
                    grade.children = gradeData;
                    this.setState({addressData: addressData});
                }else if(num == "6"){//班级
                    let classData = [];
                    let gClass = addressData[index[0]]['children'][index[1]]['children'][index[2]]['children'][index[3]]['children'][index[4]];
                    if(data.info.length==0){
                        classData = new Array(10000);
                    }else{
                        for(let i = 0 ;i < data.info.length;i++ ){
                            classData[i] = {uuid:data.info[i].uuid,value:data.info[i].orgName,select:select};
                        }
                    }
                    gClass.children = classData;
                    this.setState({addressData: addressData});
                }
            }
        }.bind(this));
    },

    /**
     * 关闭修改价格弹出框
     */
    onClickHidePop: function () {
        $(".popModel").hide();
        $(".errorMsg").hide();
        $("#range").val("2");//内容
        $("#goodsNumbers").val("");
    },
    /**
     *搜索
     */
    query: function () {
        if(this.state.orgInfo.type){
            if(this.state.menuType==2){
                this.setState({chartLoad:true});
            }
            this.listResult(this.state.orgInfo.type,this.state.orgInfo.id,this.state.listBasic);//获取所有地址
        }else{
            this.getAddressListTwo(1,'china');//获取所有地址
            this.listResult('','',this.state.listBasic);//获取所有地址
        }
    },
    /**
     * 新增设备价格改变设备类型
     */
    changeDeviceType: function () {
        this.setState({deviceType:$("#deviceType").val()});
    },
    /**
     * 设置地区状态
     * @param type 1、省 2、市 3、区 4、学校 5、年级 6、班级
     * @param [info] 数据
     * @param key 要修改键的值
     * @param [index]
     * @return {XML}
     */
    setAddress: function (type, info, key,index) {
        var addressData = this.state.addressData,isKey = key=='select'?true:false,parentType = false;
        var orgType = '',uuid = '',orgName = info.value;
        if(isKey){
            if(type == 2 && addressData[index[0]].select){
                parentType = true
            }else if(type == 3 && addressData[index[0]]['children'][index[1]].select){
                parentType = true
            }else if(type == 4 && addressData[index[0]]['children'][index[1]]['children'][index[2]].select){
                parentType = true
            }else if(type == 5 && addressData[index[0]]['children'][index[1]]['children'][index[2]]['children'][index[3]].select){
                parentType = true
            }else if(type == 6 && addressData[index[0]]['children'][index[1]]['children'][index[2]]['children'][index[3]]['children'][index[4]].select){
                parentType = true
            }
            this.removeSelectAddress(type,info);//多选的时候注释这行代码
            this.setState({addressUuid:info.uuid});
        }

        if(type==1){
            let province = addressData[index[0]];//省级
            var boo = !province[key];
            province[key] = boo;
            if(isKey){
                province.halfSelected = false;
            }
            if(province.children.length==0){//是否显示
                this.getAddressListTwo(2,info.uuid,index,info.select);
            }else if(isKey){
                for(var j = 0;j < province.children.length;j++){//市
                    let city = province.children[j];
                    city.select = boo;
                    city.halfSelected = false;
                    for(var h = 0;h < city.children.length;h++){//区
                        let town = city.children[h];
                        town.select = boo;
                        town.halfSelected = false;
                        if(town.children.length==10000){
                            continue;
                        }
                        for(var t = 0;t < town.children.length;t++){//学校
                            let school = city.children[t];
                            school.select = boo;
                            school.halfSelected = false;
                            if(school.children.length==10000){
                                continue;
                            }
                            for(var g = 0;g < school.children.length;g++){//年级
                                let grade = school.children[g];
                                grade.select = boo;
                                grade.halfSelected = false;
                                if(grade.children.length==10000){
                                    continue;
                                }
                                for(var c = 0;c < grade.children.length;c++){//班级
                                    grade.children[c].select = boo;
                                }
                            }
                        }
                    }
                }
            }
        }else if(type==2){
            let province = addressData[index[0]];//省级
            let city = province['children'][index[1]];//市级
            var boo = !(city[key]);
            if(parentType){
                boo = true;
                info.select = true;
            }
            city[key] = boo;
            if(info.select && isKey){
                province.halfSelected = true;
                city.halfSelected = false;//市级
            }else if(isKey){
                province.halfSelected = false;
            }
            if(city.children.length==0){//是否显示
                this.getAddressListTwo(3,info.uuid,index,info.select);
            }else if(isKey){
                for(var h = 0;h < city.children.length;h++){//区
                    let town = city.children[h];
                    town.select = boo;
                    for(var t = 0;t < town.children.length;t++){//学校
                        let school = city.children[t];
                        school.select = boo;
                        school.halfSelected = false;
                        if(school.children.length==10000){
                            continue;
                        }
                        for(var g = 0;g < school.children.length;g++){//年级
                            let grade = school.children[g];
                            grade.select = boo;
                            grade.halfSelected = false;
                            if(grade.children.length==10000){
                                continue;
                            }
                            for(var c = 0;c < grade.children.length;c++){//班级
                                grade.children[c].select = boo;
                            }
                        }
                    }
                }
            }
        }else if(type==3){
            let province = addressData[index[0]];//省级
            let city = province['children'][index[1]];//市级
            let town = city['children'][index[2]];//区级
            var boo = !(town[key]);
            if(parentType){
                boo = true;
                info.select = true;
            }
            town[key] = boo;
            if(info.select && isKey){
                province.halfSelected = true;
                city.halfSelected = true;
                town.halfSelected = false;
            }else if(isKey){
                province.halfSelected = false;
                city.halfSelected = false;//市级
            }
            if(town.children.length==0){//是否显示
                this.getAddressListTwo(4,info.uuid,index,info.select);
            }else if(isKey && town.children.length!=10000){
                for(var t = 0;t < town.children.length;t++){//学校
                    let school = town.children[t];
                    school.select = boo;
                    school.halfSelected = false;
                    if(school.children.length==10000){
                        continue;
                    }
                    for(var g = 0;g < school.children.length;g++){//年级
                        let grade = school.children[g];
                        grade.select = boo;
                        grade.halfSelected = false;
                        if(grade.children.length==10000){
                            continue;
                        }
                        for(var c = 0;c < grade.children.length;c++){//班级
                            grade.children[c].select = boo;
                        }
                    }
                }
            }
        }else if(type==4){
            let province = addressData[index[0]];//省级
            let city = province['children'][index[1]];//市级
            let town = city['children'][index[2]];//区级
            let school = town['children'][index[3]];//学校
            var boo = !(school[key]);
            if(parentType){
                boo = true;
                info.select = true;
            }
            school[key] = boo;
            if(info.select && isKey){
                province.halfSelected = true;//省级
                city.halfSelected = true;//市级
                town.halfSelected = true;//区级
                school.halfSelected = false;
            }else if(isKey){
                province.halfSelected = false;
                city.halfSelected = false;//市级
                town.halfSelected = false;//区级
            }
            if(school.children.length==0){//是否显示
                this.getAddressListTwo(5,info.uuid,index,info.select);
            }else if(isKey && school.children.length != 10000){
                for(var g = 0;g < school.children.length;g++){//年级
                    let grade = school.children[g];
                    grade.select = boo;
                    grade.halfSelected = false;
                    if(grade.children.length==10000){
                        continue;
                    }
                    for(var c = 0;c < grade.children.length;c++){//班级
                        grade.children[c].select = boo;
                    }
                }
            }
        }else if(type==5){
            let province = addressData[index[0]];//省级
            let city = province['children'][index[1]];//市级
            let town = city['children'][index[2]];//区级
            let school = town['children'][index[3]];//学校
            let grade = school['children'][index[4]];//年级
            var boo = !(grade[key]);
            if(parentType){
                boo = true;
                info.select = true;
            }
            grade[key] = boo;
            if(info.select && isKey){
                province.halfSelected = true;//省级
                city.halfSelected = true;//市级
                town.halfSelected = true;//区级
                school.halfSelected = true;//学校
                grade.halfSelected = false;
            }else if(isKey){
                province.halfSelected = false;
                city.halfSelected = false;//市级
                town.halfSelected = false;//区级
                school.halfSelected = false;//学校
            }
            if(grade.children.length==0){//是否显示
                this.getAddressListTwo(6,info.uuid,index,info.select);
            }else if(isKey && grade.children.length != 10000){
                for(var c = 0;c < grade.children.length;c++){//班级
                    grade.children[c].select = boo;
                }
            }
        }else if(type==6){
            let province = addressData[index[0]];//省级
            let city = province['children'][index[1]];//市级
            let town = city['children'][index[2]];//区级
            let school = town['children'][index[3]];//学校
            let grade = school['children'][index[4]];//年级
            let gClass = grade['children'][index[5]];//班级
            var boo = !(gClass[key]);
            if(parentType){
                boo = true;
                info.select = true;
            }
            gClass[key] = boo;
            if(info.select && isKey){
                province.halfSelected = true;
                city.halfSelected = true;
                town.halfSelected = true;
                school.halfSelected = true;
                grade.halfSelected = true;
            }else if(isKey){
                province.halfSelected = false;
                city.halfSelected = false;
                town.halfSelected = false;
                school.halfSelected = false;
                grade.halfSelected = false;
            }
        }
        this.setState({
            addressData: addressData,
            navigation: ''
        });
        setTimeout(function () {
            if(isKey && info.select){
                switch (type){
                    case 1:
                        orgType = 'province';
                        break;
                    case 2:
                        orgType = 'city';
                        break;
                    case 3:
                        orgType = 'town';
                        break;
                    case 4:
                        orgType = 'school';
                        break;
                    case 5:
                        orgType = 'grade';
                        break;
                    case 6:
                        orgType = 'class';
                        break;
                }
                uuid = info.uuid;
            }else if(isKey && !info.select){

                orgName = '';
                index = [];
            }else if(!isKey){
                orgType = this.state.orgInfo.type;
                uuid = this.state.orgInfo.id;
                orgName = this.state.orgInfo.orgName;
            }
            this.setState({
                orgInfo: {
                    type: orgType,
                    id: uuid,
                    index: index,
                    orgName: orgName
                },
            });
            if(isKey){
                this.listResult(orgType,uuid,this.state.listBasic);//获取所选地址统计
            }
        }.bind(this),20);
    },
    /**
     * 移除所有选中、半选中的地区
     * @return {XML}
     */
    removeSelectAddress: function (type,info) {
        var addressData = this.state.addressData;
        for(let k = 0;k<addressData.length;k++){//省级
            let province = addressData[k];
            if(type==1&&info.uuid==province.uuid){
                continue;
            }else {
                province.select = false;
                province.halfSelected = false;
            }
            if(type==0){
                province.showChild = false;
            }
            for(let j = 0;j<province.children.length;j++){
                let city = province.children[j];
                if(type==2&&info.uuid==city.uuid){//市级
                    continue;
                }else {
                    city.select = false;
                    city.halfSelected = false;
                }
                if(type==0){
                    city.showChild = false;
                }
                for(let h = 0;h<city.children.length;h++){
                    let town = city.children[h];
                    if(type==3&&info.uuid==town.uuid){//区级
                        continue;
                    }else {
                        town.select = false;
                        town.halfSelected = false;
                    }
                    if(type==0){
                        town.showChild = false;
                    }
                    if(town.children.length==10000){
                        continue;
                    }
                    for(let t = 0;t<town.children.length;t++){//学校
                        let school = town.children[t];
                        if(type==4&&info.uuid==school.uuid){
                            continue;
                        }else {
                            school.select = false;
                            school.halfSelected = false;
                        }
                        if(type==0){
                            school.showChild = false;
                        }
                        if(school.children.length==10000){
                            continue;
                        }
                        for(let g = 0;g<school.children.length;g++){//年级
                            let gard = school.children[g];
                            if(type==5&&info.uuid==gard.uuid){
                                continue;
                            }else {
                                gard.select = false;
                                gard.halfSelected = false;
                            }
                            if(type==0){
                                gard.showChild = false;
                            }
                            if(gard.children.length==10000){
                                continue;
                            }
                            for(let c = 0;c<gard.children.length;c++){//班级
                                let gClass = gard.children[c];
                                if(type==6&&info.uuid==gClass.uuid){
                                    continue;
                                }else{
                                    gClass.select = false;
                                }
                            }
                        }
                    }
                }
            }
        }
        this.setState({addressData:addressData});
    },

    /**
     * 修改菜单状态
     * @param type 1 列表 2柱状图
     * @return {XML}
     */
    changeMenuType: function (type) {
        this.setState({menuType: type});
        if(type == 2){
            this.initChartData(this.state.tableHeaderDate, this.state.tableBodyDate, type);
        }

    },
    /**
     * 柱状图数据初始化
     * 第一种情况：省市区、学校为series(例如点击量为类别不是数量)
     * 第二种情况：省市区、学校为xName
     * 第三种情况：无子集时 可以直接使用数据
     * @param tableHeaderDate
     * @param tableBodyDate
     * @param menuType
     */
    initChartData: function (tableHeaderDate, tableBodyDate, menuType) {
        if(menuType==1){
            return;
        }
        this.setState({chartLoad:true});
        var addresChartData = [],
            addresUuidData = [],
            type = [],
            arrayData = [],
            addressData = this.state.addressData,
            orgInfo = this.state.orgInfo,
            series = [],
            xName = [],
            arr = [];
        switch (orgInfo.type){
            case 'province':
                arrayData = addressData[orgInfo.index[0]]['children'];//省级
                type = 'city';
                break;
            case 'city':
                arrayData = addressData[orgInfo.index[0]]['children'][orgInfo.index[1]]['children'];//市级
                type = 'town';
                break;
            case 'town':
                arrayData = addressData[orgInfo.index[0]]['children'][orgInfo.index[1]]['children'][orgInfo.index[2]]['children'];//区级
                type = 'school';
                break;
            case 'school':
                arrayData = addressData[orgInfo.index[0]]['children'][orgInfo.index[1]]['children'][orgInfo.index[2]]['children'][orgInfo.index[3]]['children'];//学校
                type = 'grade';
                break;
            case 'grade':
                arrayData = addressData[orgInfo.index[0]]['children'][orgInfo.index[1]]['children'][orgInfo.index[2]]['children'][orgInfo.index[3]]['children'][orgInfo.index[4]]['children'];//年级
                type = 'class';
                break;
            case 'class':
                arrayData = [addressData[orgInfo.index[0]]['children'][orgInfo.index[1]]['children'][orgInfo.index[2]]['children'][orgInfo.index[3]]['children'][orgInfo.index[4]]['children'][orgInfo.index[5]].value];//年级
                break;
            default:
                arrayData = addressData;
                type = 'province';
                break;
        }
        if(orgInfo.type != 'class'){
            if(arrayData.length!=10000){
                for(let a = 0;a < arrayData.length;a++){
                    addresChartData.push(arrayData[a].value);
                    addresUuidData.push(arrayData[a].uuid);
                }
            }else{
                addresChartData = [];
            }
        }else{
            addresChartData = arrayData;
        }
        if(tableBodyDate.length==0||tableHeaderDate.length==0){
            this.setState({chartLoad:false,addressChildStatistic:{isShowBtn:false,isShowSta:false}});
            myChart.clear();
            return;
        }
        if(tableBodyDate.length>0 && /^[0-9]*$/.test(tableBodyDate[0][0])){//不是中文
            series = tableHeaderDate;
            xName = addresChartData;
            this.setState({addressChildStatistic:{isShowBtn:false,isShowSta:false}});
            if(orgInfo.type != 'class'){
                this.getChartData(type,addresUuidData,series,xName,1);//组装数据
            }else{
                for(let k = 0;k<series[0].length;k++){
                    arr.push({
                        name: series[0][k],
                        type:'bar',
                        cursor:'default',
                        data:[this.state.tableBodyDate[0][k]]
                    });
                }
                this.changeChart(series[0], xName, arr, 2);
            }
        }else if(tableBodyDate.length>0 && !/^[0-9]*$/.test(tableBodyDate[0][0])){//是中文
            series = addresChartData;
            xName = this.getClassChartData(tableBodyDate,'xName');
            if(orgInfo.type != 'class'){
                this.getChartData(type,addresUuidData,series,xName,2);//组装数据
            }else{
                //方法获取
                arr = this.getClassChartData(tableBodyDate,'arr',series);
                this.changeChart(series, xName, arr, 1);
                this.setState({addressChildStatistic:{isShowBtn:false,isShowSta:false}});
            }
        }
    },
    /**
     * 获取统计数据
     * @param orgType 区域类型
     * @param addresUuidData 区域id数组
     * @param series
     * @param xName
     * @param type
     */
    getChartData: function(orgType, addresUuidData,series,xName,type){
        var droupName = this.state.droupName;
        var listBasic = this.state.listBasic;
        var beginTime = $("#beginTime").val();
        var endTime = $("#endTime").val();
        if(listBasic==''){
            suixun.alert('请选择统计名称！');
            return;
        }
        if(droupName=='所有'){
            droupName = 0;
        }else if(droupName=='家长端'){
            droupName = 1;
        }else if(droupName=='教师端'){
            droupName = 2;
        }
        if(beginTime != '' && endTime != '' && new Date(beginTime) > new Date(endTime)){
            suixun.alert('开始时间不能大于结束时间！');
            return;
        }
        var prarm = 'name='+listBasic+'&appFrom='+droupName;
        if(beginTime!=''){
            prarm += '&beginTime='+beginTime+' 00:00:00'
        }
        if(endTime!=''){
            prarm += '&endTime='+endTime+' 23:59:59'
        }
        this.getChartListResult(orgType,prarm,addresUuidData,addresUuidData.length,series,xName,type);
    },
    /**
     * 递归获取数据
     */
    getChartListResult: function (orgType,prarm,ids,idLength,series,xName,type, listData = []) {
        if(idLength == 0){
            let arr = [];
           if(type==1){
               for(let k = 0;k<series[0].length;k++){
                   let CCArr = [];
                   for(let j = 0;j<listData.length;j++){
                       if(listData[j].length>0){
                           CCArr.push(listData[j][0][k]);
                       }else{
                           CCArr.push(0);
                       }
                   }
                   arr.push({
                       name: series[0][k],
                       type:'bar',
                       cursor:'default',
                       data:CCArr
                   });
               }
               this.changeChart(series[0], xName, arr, 2);
           }else{
               let childChaer = {
                   xName: xName,
                   series: series,
                   children: [],
                   arr: []
               },children = [];
               for(let j = 0;j<listData.length;j++){
                   let CCArr = [],child = [];
                   if(listData[j].length>0){
                       for(let x = 0; x<listData[j].length;x++){
                           let count = 0,childList = [];
                           for(let h = 1;h<listData[j][x].length;h++){
                               count += listData[j][x][h];
                               childList.push(listData[j][x][h]);
                           }
                           CCArr.push(count);
                           child.push(childList);
                       }
                   }else{
                       for(let j = 0;j<xName.length;j++){
                           CCArr.push(0);
                       }
                   }
                   arr.push({
                       name: series[j],
                       type:'bar',
                       data:CCArr
                   });
                   children.push({
                       name: series[j],
                       data:child
                   });
               }
               childChaer.children = children;
               childChaer.arr = arr;
               this.setState({childChaer:childChaer,addressChildStatistic:{isShowBtn:true,isShowSta:false}});
               this.changeChart(series, xName, arr, 1);
           }
        }else{
            var prarms = prarm,boo = false;
            prarms += '&orgType='+orgType+'&orgId='+ids[ids.length-idLength];
            suixun.ajax( serverUrl+'/count/listResult.json?'+prarms,'',"get",function(data){
                if(data.code == 200 && data.info!=null && data.info.length!=0){
                    var listResultData = data.info,tableHeaderDate = [],tableBodyDate = [],isLength = false;
                    this.setState({listResultData:data.info==null?[]:data.info});
                    for(var j = 0;j<listResultData.length;j++){
                        var head = [],
                            body = [];
                        for(var key in listResultData[j]){
                            if(j == 0){
                                head.push(key);
                            }
                            if(listResultData[j][key] == null){
                                isLength = true;
                                break;
                            }
                            body.push(listResultData[j][key]);
                        }
                        if(j == 0){
                            tableHeaderDate.push(head);
                        }
                        tableBodyDate.push(body);
                    }
                    if(isLength){
                        tableBodyDate = [];
                    }
                    boo = true;
                    listData.push(tableBodyDate);
                    this.getChartListResult(orgType, prarm, ids, idLength-1,series,xName,type, listData);
                    return listData;
                }else{
                    listData.push([]);
                    boo = true;
                    this.getChartListResult(orgType, prarm, ids, idLength-1,series,xName,type, listData);
                    return listData;
                }
            }.bind(this));
        }
    },
    /**
     * 获取数据——没有子集时
     * @param tableBodyDate
     * @param type xName  arr
     * @param series xName  arr
     * @return classChartData
     */
    getClassChartData: function (tableBodyDate,type,series = []) {
        if(type=='arr'){
            let CCArr = [];
            for(let k = 0;k<tableBodyDate.length;k++){
                let count = 0;
                for(let h = 1;h<tableBodyDate[k].length;h++){
                    count +=  tableBodyDate[k][h];
                }
                CCArr.push(count);
            }
            return [{
                name: series[0],
                type:'bar',
                cursor:'default',
                data:CCArr
            }];
        }else{
            let CCXName = [];
            for(let k = 0;k<tableBodyDate.length;k++){
                CCXName.push(tableBodyDate[k][0]);
            }
            return CCXName;
        }
    },
    /**
     * 获取下一级数据
     * @param seriesName 颜色name
     * @param name x轴name
     * @param xNameArr
     * @param color
     */
    setChildChart: function (seriesName, name, xNameArr, color) {
        if(!myChartTwo){
            myChartTwo = echarts.init(document.getElementById('echartStatistic02'));
        }
        let childChaer = this.state.childChaer;
        let series = [],
            arr = [];
        for(let j = 0;j<childChaer.children.length;j++){
            if(seriesName==childChaer.children[j].name){
                for(let h = 1;h<this.state.tableHeaderDate[0].length;h++) {
                    let arrData = [];
                    for (let k = 0; k < childChaer.children[j].data.length; k++) {
                        arrData.push(childChaer.children[j].data[k][h-1]);
                    }
                    series.push(this.state.tableHeaderDate[0][h]);
                    arr.push({
                        name: this.state.tableHeaderDate[0][h],
                        type: 'bar',
                        data: arrData
                    });
                }
                break;
            }
        }
        optionTwo = {
            tooltip: {
                trigger: 'axis',
                axisPointer : {// 坐标轴指示器，坐标轴触发有效
                    type : 'shadow'// 默认为直线，可选为：'line' | 'shadow'
                }
            },
            legend: {
                data: series
            },
            grid: { // 控制图的大小，调整下面这些值就可以，
                x: 40,
                x2: 100,
                y2: 150,// y2可以控制 X轴跟Zoom控件之间的间隔，避免以为倾斜后造成 label重叠到zoom上
            },
            xAxis: [
                {
                    type : 'category',
                    axisLabel:{//控制名称旋转角度
                        interval:0,
                        rotate:90,
                        margin:2,
                    },
                    data: xNameArr
                }
            ],
            yAxis: [
                {
                    type : 'value'
                }
            ],
            series: arr
        };
        myChartTwo.setOption(optionTwo);
        $(window).resize(function () {
            myChartTwo.resize();
        });

    },
    /**
     * 设置地区总量统计
     */
    setAddressChildChart:function () {
        suixun.showLoding();
        this.setState({addressChildStatistic:{
            isShowBtn: true,
            isShowSta: true
        }});
        setTimeout(function () {
            this.changeChartThree();
        }.bind(this),1);

    },
    /**
     * 修改柱状图03
     */
    changeChartThree: function () {
        if(!myChartThree){
            myChartThree = echarts.init(document.getElementById('echartStatistic03'));
        }
        let childChaer = this.state.childChaer,CCArr = [];
        for(let j = 0;j<childChaer.arr.length;j++){
            let dataCount = 0;
            for(let k = 0;k<childChaer.arr[j].data.length;k++){
                dataCount += childChaer.arr[j].data[k];
            }
            CCArr.push(dataCount);
        }
        optionThree = {
            tooltip: {
                trigger: 'axis',
                axisPointer : {// 坐标轴指示器，坐标轴触发有效
                    type : 'shadow'// 默认为直线，可选为：'line' | 'shadow'
                }
            },
            legend: {
                data: [this.state.listBasic]
            },
            grid: { // 控制图的大小，调整下面这些值就可以，
                x: 40,
                x2: 100,
                y2: 150,// y2可以控制 X轴跟Zoom控件之间的间隔，避免以为倾斜后造成 label重叠到zoom上
            },
            xAxis: [
                {
                    type : 'category',
                    axisLabel:{//控制名称旋转角度
                        interval:0,
                        rotate:90,
                        margin:2,
                    },
                    data: childChaer.series
                }
            ],
            yAxis: [
                {
                    type : 'value'
                }
            ],
            series: [{
                name: this.state.listBasic,
                type:'bar',
                cursor:'default',
                data:CCArr
            }]
        };
        $(window).resize(function () {
            myChartThree.resize();
        });
        this.setNavigation('总量统计');
        myChartThree.setOption(optionThree);
        suixun.hideLoding();
    },
    componentDidUpdate: function(prevProps, prevState){
        if(this.state.menuType==2&&this.state.chartLoad){
            suixun.showLoding();
        }else if(this.state.menuType==2&&!this.state.chartLoad){
            suixun.hideLoding(500);
        }
    },
    /**
     * 改变柱状图
     * @param series
     * @param xName
     * @param arr
     * @param type 1：添加点击事件 2：不添加点击事件
     */
    changeChart: function (series, xName, arr, type) {
        if(!myChart){
            myChart = echarts.init(document.getElementById('echartStatistic'));
        }
        option = {
            tooltip: {
                trigger: 'axis',
                axisPointer : {// 坐标轴指示器，坐标轴触发有效
                    type : 'shadow'// 默认为直线，可选为：'line' | 'shadow'
                }
            },
            legend: {
                data: series
            },
            grid: { // 控制图的大小，调整下面这些值就可以，
                x: 40,
                x2: 100,
                y2: 150,// y2可以控制 X轴跟Zoom控件之间的间隔，避免以为倾斜后造成 label重叠到zoom上
            },
            xAxis: [
                {
                    type : 'category',
                    axisLabel:{//控制名称旋转角度
                        interval:0,
                        rotate:90,
                        margin:2,
                    },
                    data: xName
                }
            ],
            yAxis: [
                {
                    type : 'value'
                }
            ],
            series: arr
        };
        // debugger
        this.setState({chartLoad:false});
        myChart.setOption(option, {
            notMerge: true
        });
        // myChart.setOption(option);
        if(type==1){//第一种情况
            /**
             * 点击事件
             */
            myChart.on('click', function (param){
                // alert('柱状图的值：'+param.seriesName+'；X轴的的值：'+param.name);
                this.setNavigation(param.seriesName);
                setTimeout(function () {
                    this.setChildChart(param.seriesName,param.name,xName,param.color);
                }.bind(this),10);
            }.bind(this));
        }else{
            myChart.off('click');
        }
        $(window).resize(function () {
            myChart.resize();
        });
    },

    /**
     * 设置下拉选择框内容
     * @return {XML}
     */
    setDroup: function (name, type) {
        if(type=='droupName'){
            this.setState({droupName:name});
            setTimeout(function () {
                this.listResult(this.state.orgInfo.type,this.state.orgInfo.id,this.state.listBasic);//获取所选地址统计
            }.bind(this),100);
        }else{
            this.setState({listBasic:name});
            this.listResult(this.state.orgInfo.type,this.state.orgInfo.id,name);//获取所选地址统计
        }

    },
    /**
     * 搜索开始日期发生变化
     * @param e
     */
    changeBeginTime: function (e) {
        if(new Date($('#endTime').val())<new Date(e.target.value)){
            $('#endTime').val('')
        };
        $('#endTime').datetimepicker({
            format: "Y-m-d", //格式化日期
            timepicker: false, //显示时间选项
            todayButton: false, //关闭选择今天按钮
            step:1,//时间间隔
            minDate: e.target.value, // and tommorow is maximum date calendar
        });
    },
    /**
     * 设置柱状图
     * @return {XML}
     */
    setNavigation: function (name) {
        if(name==''){
            this.setState({addressChildStatistic:{
                isShowBtn: this.state.addressChildStatistic.isShowBtn,
                isShowSta: false
            }})
            // this.initChartData(this.state.tableHeaderDate, this.state.tableBodyDate, this.state.menuType);
        }
        this.setState({navigation:name})
    },
    /**
     *
     */
    setOrgInfo:function(){
        this.setState({
            orgInfo: {
                type: '',
                id: '',
                index: [],
                orgName: ''
            },
        });
        this.removeSelectAddress(0,{uuid:'00'});//多选的时候注释这行代码
        this.listResult('','',this.state.listBasic);//获取所选地址统计
    },
    render: function () {
        {
            var menuType = this.state.menuType;
            /**
             * 组装数据
             * @type {Array}
             */
            var addressDatas = this.state.addressData.map(function (provinceData,provinceIndex) {//循环输出省级地址
                return (
                    <div className="provinces">
                        <div className="province-content">
                            <span className={provinceData.showChild?"addressTriangle  isOpen":"addressTriangle "} onClick={this.setAddress.bind(this,1,provinceData,'showChild',[provinceIndex])}/>
                            <span className={provinceData.select?"addressRadio  isSelect":"addressRadio"} onClick={this.setAddress.bind(this,1,provinceData,'select',[provinceIndex])}/>
                            <span className={provinceData.halfSelected?provinceData.showChild?"addressValue text-sub ":"addressValue text-sub halfSelected":"addressValue text-sub"} title={provinceData.value}  onClick={this.setAddress.bind(this,1,provinceData,'select',[provinceIndex])}>
                                {provinceData.value}
                            </span>
                        </div>
                        {
                            provinceData.showChild?
                                provinceData.children.map(function (cityData,cityIndex) {//循环输出市级地址
                                    return (
                                        <div className="citys">
                                            <div className="city-content">
                                                <span className={cityData.showChild?"addressTriangle isOpen":"addressTriangle"} onClick={this.setAddress.bind(this,2,cityData,'showChild',[provinceIndex,cityIndex])}/>
                                                <span className={cityData.select?"addressRadio isSelect":"addressRadio "} onClick={this.setAddress.bind(this,2,cityData,'select',[provinceIndex,cityIndex])}/>
                                                <span className={cityData.halfSelected?cityData.showChild?"addressValue text-sub ":"addressValue text-sub halfSelected":"addressValue  text-sub"} title={cityData.value}  onClick={this.setAddress.bind(this,2,cityData,'select',[provinceIndex,cityIndex])}>
                                                    {cityData.value}
                                                </span>
                                            </div>
                                            {
                                                cityData.showChild?
                                                    cityData.children.map(function (countyData,countyIndex) {//循环输出区级地址
                                                        return (
                                                            <div className="countys">
                                                                <div className="county-content ">
                                                                    <span className={countyData.showChild?"addressTriangle isOpen":"addressTriangle"} onClick={this.setAddress.bind(this,3,countyData,'showChild',[provinceIndex,cityIndex,countyIndex])}/>
                                                                    <span className={countyData.select?"addressRadio isSelect":"addressRadio"} onClick={this.setAddress.bind(this,3,countyData,'select',[provinceIndex,cityIndex,countyIndex])}/>
                                                                    <span className={countyData.halfSelected?countyData.showChild?"addressValue text-sub ":"addressValue text-sub halfSelected":"addressValue  text-sub"} title={countyData.value} onClick={this.setAddress.bind(this,3,countyData,'select',[provinceIndex,cityIndex,countyIndex])}>
                                                                        {countyData.value}
                                                                    </span>
                                                                </div>
                                                                {
                                                                    countyData.showChild?
                                                                        countyData.children.length==10000?
                                                                            <div className="countys">
                                                                                <div className="county-content ">
                                                                                    <span className="text-sub" style={{color:'red'}}>
                                                                                       没有获取到学校
                                                                                    </span>
                                                                                </div>
                                                                            </div>
                                                                            :
                                                                            countyData.children.map(function (schoolData,schoolIndex) {//循环输出学校
                                                                                return (
                                                                                    <div className="countys">
                                                                                        <div className="county-content ">
                                                                                            <span className={schoolData.showChild?"addressTriangle isOpen":"addressTriangle"} onClick={this.setAddress.bind(this,4,schoolData,'showChild',[provinceIndex,cityIndex,countyIndex,schoolIndex])}/>
                                                                                            <span className={schoolData.select?"addressRadio isSelect":"addressRadio"} onClick={this.setAddress.bind(this,4,schoolData,'select',[provinceIndex,cityIndex,countyIndex,schoolIndex])}/>
                                                                                            <span className={schoolData.halfSelected?schoolData.showChild?"addressValue text-sub ":"addressValue text-sub halfSelected":"addressValue  text-sub"} title={schoolData.value}  onClick={this.setAddress.bind(this,4,schoolData,'select',[provinceIndex,cityIndex,countyIndex,schoolIndex])}>
                                                                                                {schoolData.value}
                                                                                            </span>
                                                                                        </div>
                                                                                        {
                                                                                            schoolData.showChild?
                                                                                                schoolData.children.length==10000?
                                                                                                    <div className="countys">
                                                                                                        <div className="county-content ">
                                                                                                            <span className="text-sub" style={{color:'red'}}>
                                                                                                               没有获取到年级
                                                                                                            </span>
                                                                                                        </div>
                                                                                                    </div>
                                                                                                    :
                                                                                                    schoolData.children.map(function (gradeData,gradeIndex) {//循环输出年级
                                                                                                        return (
                                                                                                            <div className="countys">
                                                                                                                <div className="county-content ">
                                                                                                                    <span className={gradeData.showChild?"addressTriangle isOpen":"addressTriangle"} onClick={this.setAddress.bind(this,5,gradeData,'showChild',[provinceIndex,cityIndex,countyIndex,schoolIndex,gradeIndex])}/>
                                                                                                                    <span className={gradeData.select?"addressRadio isSelect":"addressRadio"} onClick={this.setAddress.bind(this,5,gradeData,'select',[provinceIndex,cityIndex,countyIndex,schoolIndex,gradeIndex])}/>
                                                                                                                    <span className={gradeData.halfSelected?gradeData.showChild?"addressValue text-sub ":"addressValue text-sub halfSelected":"addressValue  text-sub"} title={gradeData.value} onClick={this.setAddress.bind(this,5,gradeData,'select',[provinceIndex,cityIndex,countyIndex,schoolIndex,gradeIndex])}>
                                                                                                                        {gradeData.value}
                                                                                                                    </span>
                                                                                                                </div>
                                                                                                                {
                                                                                                                    gradeData.showChild?
                                                                                                                        gradeData.children.length==10000?
                                                                                                                            <div className="countys">
                                                                                                                                <div className="county-content ">
                                                                                                                                    <span className="text-sub" style={{color:'red'}}>
                                                                                                                                       没有获取到班级
                                                                                                                                    </span>
                                                                                                                                </div>
                                                                                                                            </div>
                                                                                                                            :
                                                                                                                            gradeData.children.map(function (classData,classIndex) {//循环输出班级
                                                                                                                                return (
                                                                                                                                    <div className="countys">
                                                                                                                                        <div className="county-content">
                                                                                                                                            <span className={classData.select?"addressRadio isSelect":"addressRadio"} onClick={this.setAddress.bind(this,6,classData,'select',[provinceIndex,cityIndex,countyIndex,schoolIndex,gradeIndex,classIndex])}/>
                                                                                                                                            <span className="addressValue text-sub" title={classData.value}  onClick={this.setAddress.bind(this,6,classData,'select',[provinceIndex,cityIndex,countyIndex,schoolIndex,gradeIndex,classIndex])}>
                                                                                                                                                {classData.value}
                                                                                                                                            </span>
                                                                                                                                        </div>
                                                                                                                                    </div>
                                                                                                                                )
                                                                                                                            }.bind(this))
                                                                                                                        :''
                                                                                                                }
                                                                                                            </div>
                                                                                                        )
                                                                                                    }.bind(this))
                                                                                                :''
                                                                                        }
                                                                                    </div>
                                                                                )
                                                                            }.bind(this))
                                                                        :''
                                                                }

                                                            </div>
                                                        )
                                                    }.bind(this)):''
                                            }
                                        </div>
                                    )
                                }.bind(this)):''

                        }
                    </div>
                )
            }.bind(this));
            var tableHeader = this.state.tableHeaderDate.length==0?'':this.state.tableHeaderDate.map(function (value) {
                return (
                    <thead>
                        <th >序号</th>
                        {
                            value.map(function (thValue) {
                                return (
                                    <th >{thValue}</th>
                                )
                            })
                        }
                    </thead>
                )
            });
            var tableBody = this.state.tableBodyDate.length==0?'':this.state.tableBodyDate.map(function (trDate,index) {
                return (
                    <tr>
                        <td>{index+1}</td>
                        {
                            trDate.map(function (tdDate) {
                                return (
                                    <td>{tdDate}</td>
                                    )
                            })
                        }
                    </tr>
                )
            });
        }
        return (
            <div className="tableManage-body integralStatistics">
                <header>
                    <div className="header-left">
                        <div className="header-left-studentInfo">
                            <span className={this.state.menuType=='1'?"header-left-button menu-width  showOrder":"header-left-button menu-width "} onClick={this.changeMenuType.bind(this,1)}>列表</span>
                            <span className={this.state.menuType=='2'?"header-left-button menu-width  showOrder":"header-left-button menu-width "} onClick={this.changeMenuType.bind(this,2)}>柱状图</span>
                        </div>
                        <div className="header-left-annotationsInfo">
                            <img src="../img/icon/annotations.png" />
                            <span className="header-left-annotations-arrowsLeft"/>
                            <div className="header-left-annotations">这里是注释。</div>
                        </div>
                    </div>
                    <div className="header-right" style={{clear:'both',left:'329px'}}>
                        <div className="header-right-select droup-select left-droup-select" style={{borderRadius: '5px',position:'relative',marginRight:'20px',width:'150px'}}>
                            <div className="school-or-table school-or-parent text-sub" style={{width:'125px'}} title={this.state.listBasic}>{this.state.listBasic}</div>
                            <span className="lower-right-corner" style={{left:'130px'}}/>
                            <div className="drop-down left-drop-down" >
                                {
                                    this.state.listBasicData.map(function (data) {
                                        return(
                                            <span className="select-value school-name text-sub" title={data.name} onClick={this.setDroup.bind(this,data.name,'listBasic')}>{data.name}</span>
                                        )
                                    }.bind(this))
                                }
                            </div>
                        </div>
                        <div className="header-right-select droup-select right-droup-select" style={{borderRadius: '5px',position:'relative',marginRight:'20px'}}>
                            <div className="school-or-table school-or-parent">{this.state.droupName}</div>
                            <span className="lower-right-corner"/>
                            <div className="drop-down right-drop-down" >
                                <span className="select-value school-name" onClick={this.setDroup.bind(this,'所有','droupName')}>所有</span>
                                <span className="select-value school-name" onClick={this.setDroup.bind(this,'家长端','droupName')}>家长端</span>
                                <span className="select-value school-name" onClick={this.setDroup.bind(this,'教师端','droupName')}>教师端</span>
                            </div>
                        </div>


                    </div>
                </header>
                <div className="body-updateAttendance" style={{top:'-59px',left:'635px',width:'450px'}}>
                    <div className="body-content" >
                        <div className="body-content-text" style={{paddingLeft:'0'}}>
                            <div className="content-border content-time" style={{lineHeight:'36px',height:'36px',marginTop:'-6px'}}>
                                <input type="text" className="input-content input-time" id="beginTime" placeholder="开始时间" maxLength="50" onBlur={this.changeBeginTime.bind(this)} />
                            </div>
                            <span className="content-time-line" style={{margin:'12px 12px'}}/>
                            <div className="content-border content-time" style={{lineHeight:'36px',height:'36px',marginTop:'-6px'}}>
                                <input type="text" className="input-content input-time" id="endTime" placeholder="结束时间" maxLength="50" />
                            </div>
                        </div>
                    </div>
                    <div className="header-right-botton" style={{top: '0',marginLeft: '450px',position: 'absolute',width: '30px'}} onClick={this.query.bind(this)}>搜索</div>
                </div>
                <div id="content-left" style={{top:'-36px'}}>
                    <div id="left-body" style={{height:'619px'}}>
                        <div>
                            {/*<div className={this.state.orgInfo.id==''?'menu-radio-list select':'menu-radio-list'}><span>全国</span></div>*/}
                            <div className="province-content">
                                <span className={this.state.orgInfo.id==''?"addressRadio  isSelect":"addressRadio"} style={{marginLeft:'-12px'}} onClick={this.setOrgInfo.bind(this)}/>
                                <span className="addressValue text-sub " onClick={this.setOrgInfo.bind(this)}>
                                    全国
                                </span>
                            </div>
                        </div>

                        <div className="addressAll" id="left-body-contents">
                            {addressDatas}
                        </div>
                    </div>
                </div>

                <div id="content-right"  style={{top:'-55px'}}>
                    <div >注意：<span style={{color:'red'}}>没有选择地区时，统计的全国；教师端只可统计到学校。</span></div>
                    {/*<div style={{display:this.state.menuType=='1'?'block':'none'}}>注意：<span style={{color:'red'}}>没有选择地区时，统计的全国。</span></div>*/}
                    <div id="right-head" >
                        <div id="right-body">
                            <div className="tableInfo tableInfo-change" style={{display:this.state.menuType=='1'?'block':'none'}}>
                                <div className="studentsInfo-data tableInfo-data">
                                    <div id="studentsInfo-data-table" className="studentsInfo-data-table tableInfo-data-table" >
                                        <table className="head-body">
                                            {
                                                tableHeader==''?<thead></thead>:tableHeader
                                            }
                                            <tbody>
                                            {tableBody}
                                            </tbody>
                                        </table>
                                        {
                                            tableBody == 0?<div className="tableNoData">{tableNoDataCount}</div>:''
                                        }
                                    </div>
                                </div>
                            </div>

                            <div style={this.state.navigation!=''?{display:'none'}:{display:this.state.menuType=='2'?'block':'none'}} className='navigation'>
                                统计范围：{this.state.orgInfo.orgName==''?'全国':this.state.orgInfo.orgName}
                                <span className="header-right-botton" style={{display:this.state.addressChildStatistic.isShowBtn?'inline-block':'none'}} onClick={this.setAddressChildChart.bind(this)}>总量统计</span>
                            </div>
                            <div style={this.state.navigation==''?{display:'none'}:{display:this.state.menuType=='2'?'block':'none'}} className='navigation selsect' >
                                <a href="javascript:void(0);" onClick={this.setNavigation.bind(this,'')}>统计范围：{this.state.orgInfo.orgName==''?'全国':this.state.orgInfo.orgName}</a><span>>{this.state.navigation}</span>
                            </div>
                            {
                                (this.state.tableBodyDate.length == 0||this.state.tableHeaderDate.length==0)&&this.state.menuType==2?<div className="tableNoData" style={{borderLeft:'1px solid #dddddd',borderRight:'1px solid #dddddd'}}>{tableNoDataCount}</div>:''
                            }
                            <div className="echartStatistic " style={{display:this.state.menuType=='2'?this.state.addressChildStatistic.isShowSta?'block':'none':'none'}} id="echartStatistic03" ></div>
                            <div className="echartStatistic " id="echartStatistic" style={{display:this.state.menuType=='2'?this.state.navigation==''?this.state.tableBodyDate.length==0||this.state.tableHeaderDate.length==0?'none':'block':'none':'none'}}></div>
                            <div className="echartStatistic " id="echartStatistic02" style={{display:this.state.menuType=='2'?this.state.navigation==''?'none':this.state.addressChildStatistic.isShowSta?'none':'block':'none'}}></div>
                        </div>
                    </div>
                </div>
                <footer id="copyright">
                    <span><img src="../img/icon/copyright.png"/>{copyright}</span>
                </footer>
            </div>
        );
    }
});
ReactDOM.render(
    <Main />,
    document.getElementById('tableManage')
);
$(window).resize(function () {
    leftList();
});
$(function () {
    setTimeout(function () {
        leftList();
    },500);
    setTimeout(function () {
        leftList();
    },2000);
});
function leftList(){
    if($("#studentsInfo-data-table").height()+77 > $(window).height()){
        $("#left-body").css("height",$("#studentsInfo-data-table").height()+77-30+"px");
    }else{
        $("#left-body").css("height",$(window).height()-260+"px");
    }
}
/**
 * 点击下拉框——下拉框依赖
 */
$(".droup-type").click(function () {
    var dropDown = $('.drop-down');
    if(dropDown.is(":hidden")){
        dropDown.slideDown();
    }else{
        dropDown.slideUp();
    }
});
/**
 * 点击积分类型下拉选项
 */
$(".left-droup-select").click(function () {
    $('.right-drop-down').slideUp();
    var dropDown = $(this).find('.left-drop-down');
    if(dropDown.is(":hidden")){
        dropDown.slideDown();
    }else{
        dropDown.slideUp();
    }
});
/**
 * 点击用户端
 */
$(".right-droup-select").click(function () {
    $('.left-drop-down').slideUp();
    var dropDown = $(this).find('.right-drop-down');
    if(dropDown.is(":hidden")){
        dropDown.slideDown();
    }else{
        dropDown.slideUp();
    }
});
